<!-- Javascript functions -->
<script src="../mod/assignment/type/program/js/tests.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
    // Global variable id: Number of test + 1
    var id = <?php echo $numtests+1 ?>;
    
    var pixpath = '<?php echo $CFG->pixpath ?>';
</script>
<!-- End -->

<!-- Program tests -->
<table align="center" cellpadding="5" cellspacing="0" id="tests">
<?php
    if($tests) {
        // Tests allready defined (update assignment)
        $i = 1;
        foreach($tests as $tstObj => $tstValue) {
?>
<tbody id="test<?php echo $i ?>">
    <tr valign="top" style="border-bottom: 1px solid #BBBBBB;">
        <td colspan="2">
            <a href="#" onclick="Javascript:delTest(<?php echo $i ?>);">
            <img src="<?php echo $CFG->pixpath ?>/t/switch_minus.gif" alt="Delete" title="<?php print_string('deletetest', 'epaile') ?>" /></a>&nbsp;<strong>Test</strong>
        </td>
    </tr>
    <tr>
        <td align="right">
            <strong><?php print_string('input', 'assignment') ?>:</strong> <input type="text" name="input[]" size="30" value="<?php p($tstValue->input) ?>">
        </td>
        <td>
            <strong><?php print_string('output', 'assignment') ?>:</strong> <input type="text" name="output[]" size="30" value="<?php p($tstValue->output) ?>">
        </td>
    </tr>
</tbody>
<?php
            $i++;
        }
    } else {
        // New assignment
        for($i=1; $i<=$numtests; $i++) {
?>
<tbody id="test<?php echo $i ?>">
    <tr valign="top" style="border-bottom: 1px solid #BBBBBB;">
        <td colspan="2"><a href="#" onclick="Javascript:delTest(<?php echo $i ?>);"><img src="<?php echo $CFG->pixpath ?>/t/switch_minus.gif" alt="Delete" title="Delete test" /></a>&nbsp;<strong>Test</strong></td>
    </tr>

    <tr>
        <td align="right"><strong><?php print_string('input', 'assignment') ?>:</strong> <input type="text" name="input[]" size="30" value=""></td>
        <td><strong><?php print_string('output', 'assignment') ?>:</strong> <input type="text" name="output[]" size="30" value=""></td>
    </tr>
</tbody>
<?php
        }
    }
?>
</table>
<table align="center" cellpadding="5" cellspacing="0">
<tr>
    <td align="left" colspan="2"><a href="Javascript:addTest();"><img src="<?php echo $CFG->pixpath ?>/t/switch_plus.gif" alt="Add" title="<?php print_string('addtest', 'assignment') ?>" /> <?php print_string('addtest', 'assignment') ?></a></td>
</tr>
</table>
<!-- End program tests -->
